<template>
  <view class="report" style="height: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	background-color: #009EF0;
	background: url('../../../static/image/background1.png') no-repeat center;
	background-size: cover;">
    <view class="title">
      <text>情况上报</text>
    </view>
    <view class="reportlist" v-for="(item,index) in list" :key="index" @click="details(item)">
      <text class="topic">{{ item.titleTopic }}</text>
      <text class="name">姓名：{{ item.userName }}</text>
      <text class="department">所属部门：{{ item.departmentName }}</text>
      <text class="time">时间：{{ item.createTime }}</text>
    </view>
    <!-- <view>
      <uni-pagination title="标题文字" show-icon="true" total="50" :current="pagenum" @change="pagination"></uni-pagination>
    </view> -->
  </view>
</template>

<script>
import { ajax } from "../../../api/apis";
// import uniPagination from "@/components/uni-pagination/uni-pagination";
export default {
  data() {
    return {
      list: [],
      report: {
        departmentId: "",
        endDate: "",
        page: 1,
        size: 20,
        startDate: ""
      }
    };
  },
  components:{},
  methods:{
	  details(item) {
	  	console.log(item);
	    uni.navigateTo({
	      url: "../details/details?warningMessageID="+item.warningMessageID+"&departmentId="+item.departmentId+"&departmentName="+item.departmentName,
	    });
	  },
	  getReportList(){
		  const _this = this;
		  ajax({
		    url: "/reportList/listReport",
		    method: "POST",
		    data: _this.report,
		    success: res => {
		      console.log(res.data.data);
		      _this.list=res.data.data.list
		    }
		  });
	  }
  },
  onPullDownRefresh() {
  	this.getReportList();
  	if(timer != null){
  	   clearTimeout(timer);
  	  }
  	let timer=setTimeout(function() {
  		uni.stopPullDownRefresh();
  	}, 1000);
  },
  onReachBottom(){
  	let _this=this
  	this.report.page+=1;
  	this.getReportList()
  },
  mounted() {
    this.getReportList();
  }
};
</script>

<style scoped>
uni-page-body {
  height: 100%;
}
.report {
  height: 100%;
  background-color: #f9f9f9;
}
.title {
  font-size: 16px;
  padding: 15px;
  color: #fff;
  text-align: center;
  background: url("../../../static/image/navbg.png") no-repeat center;
}
.reportlist {
  /* background-color: #fff; */
  box-sizing: border-box;
  margin: 9px 10px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  padding: 6px 25px;
  line-height: 24px;
  box-shadow: 0px 2px 5px #ccc;
}
.topic{
  font-size: 14px;
  font-weight: bold;
}
.name {
  font-size: 12px;
  color: #009ff1;
}
.department,
.time {
  font-size: 12px;
  color: #eee;
}

</style>